All right.
So now let's go ahead and add a little UI, a user interface so that when you get the coin, it's going
to show.
Plus however many points, we can add a plus ten.
Also, there's going to be a sound associated with it.
Let's check it out.
Boom, There we go.
Plus ten.
That's kind of cool.
Let's go ahead and get started.
We are going to create the award label and the sound on the player's machine, also known as the client
machine.
The player is the client, but the coin is on the server.
Everyone can see and possibly get the coin, but only you are going to see the label and hear the sound
In order for client stuff and server stuff to communicate, we need something called a remote event.
It's a gateway between the client and the server, so let's go ahead and do that.
Now, if we take a look at our Explorer window, go down to replicated storage, replicated storage
is able to be seen by the client and the server, and it's a good place for gateways like remote events.
There's also a remote function, but I hardly ever use those.
We're going to use remote events.
Let's hit the plus, sign a replicated storage and I have it under frequently used.
If you don't just go ahead and do our team, look at that remote event and remote functions the other
way of doing it.
There we go.
Let's go ahead and name this remote event award points r e.
This is our gateway between our coin and our user interface.
Let's go to server storage.
Open that up and then find the coin that we spawn into our world.
Let's open that up, open up the collect script and that up at the top we are going to get a variable
for replicated storage, local RRS for replicated storage game, get service replicated storage.
Now we have a variable for that.
We can get the remote event in it.
Let's make another variable called r e for remote event.
We're going to get the variable for replicated storage colon wait for child award points r e.
Now this must be spelt the same as this in replicated storage.
One letter off is not good enough.
So after we get our coin right, this is where we check to see if the player is what?
Touch the coin.
We are going to fire something to the player using the remote event.
We're going to say Ori for remote event colon fire client.
We need to pass in the client that we're going to, so we need to pass in player.
Luckily we got the player.
We also can pass in any information we want after that, very we can send a whole bunch of variables.
We're only going to do one.
We're going to send the ten for the points.
Right?
But I don't like sending literals and using literals and code literal literals.
When you actually put the value right there, when you just type it in, let's go ahead and get a variable
for that.
Let's do p t point val for point value.
Make that ten.
Go ahead and copy that and we'll just replace the p t man point Val with our ten.
Same here.
Now we have less literals in our code.
We still have some down here, but that's fine.
We'll we'll clean them up if we need to.
Let's take a look at our zombie game right here, and we're going to have a little tiny label that's
going to float up when we get a coin.
So let's add that to the game.
Now let's go to Starter Guy or starter guy.
This is where you add your components.
When a player enters a game, the starter guy is cloned to the player and becomes the player guy.
On the starter guy, we can add something called a screen guy.
Go ahead and hit that plus hit screen guy or search if it's not there.
Screen guy.
Now the screen guy covers the screen and holds components.
So now we can add components to the screen guy and you can change this name if you want.
I'm just going to keep it.
Screen guy.
Let's hit the plus again.
Let's add a text label.
There we go.
Here's our tax label.
Let's rename that text label to a weird label ward label that's just going to give us the plus, the
plus ten and stuff like that.
We're going to make a really small let's go and take a look at anchor point.
What's anchor point?
Well, we have two numbers comma delimited.
It is where we connect the component to the screen.
Guy right now at 0000 is the upper left corner.
So that's where it's being attached to our to our screen gooey.
If we change this anchor point, that's a scale from 0 to 1.
Let's do it a11.
Now, the anchor point is right here on the component that move the component up.
I want it right dead center.
So I'm going to make the anchor .0.5 and point five.
There we go.
There's our anchor point.
You can kind of see it.
Now, I want to center this, so I'm going to go down a little bit.
And right where it says position, we have a bunch of numbers, we have X, and if we open up X, we
have scale and offset, we have Y.
If we open up Y, we have scale and offset.
So scale is the percentage, it's the distance of the parent object on a scale from 0 to 1.
So 0.5 is on the center right.
So if we do X with a 0.5 and the X, let's just change its scale here and you should play around with
every place you can change it.
It's very flexible.
Robots is very flexible like this.
I'm going to hit 0.5 on the scale boom, that's halfway on my x axis.
Now I'm going to do 0.5 on my Y scale.
0.5.
There we go.
Pixel offset just adds pixels to that number.
So if we add pixels, don't do this because we're going to delete it.
But let's say let's add 20 to our offset, it just shifted at 20 pixels.
I'm going to put it back to zero.
I just wanted you to see it.
Let's go down to scale.
Scale are not scale size.
Size is the same thing.
Size.
We have an X and Y, we open those up, we have a scale and an offset scale and an offset.
This is in pixels.
I think I'm going to keep it in pixels.
I'm not going to use scale, I'm going to make the offset on the x 50.
So that's 50 pixels on the X, there we go and it's already 50 pixels on the Y.
That's perfect.
It's going to be a little square.
Let's check to see if our position has changed.
It has not.
That's because the anchor point was in the center.
If the anchor point was up here, we would have to reposition.
That's just kind of an artifact of where the anchor point is.
And if you size something, if it's going to change position or not.
All right.
Now let's go down to text.
So we have text here font face.
I'm going to go with this comic.
Whatever you call it, that's a pretty good text.
If you lose it, you won't be able to click it again.
You have to come over here and click it that way.
And what else should we change on the text?
Let's change how big the text is.
I'm going to do something crazy.
I'm going to hit something called Text scaled.
And the robots guesses how big they should make it.
I'm also going to change the color to that.
Let's here, let's see this text.
Color three.
Press that.
Yellow.
Ban yellow tags.
Hardly can see it.
Hmm.
Maybe if we get a little outline around the text.
Text?
Stroke, transparency.
Let's make it one that's a little better.
But you know what?
I'm going to make this whole thing invisible except for the text.
Before I do that, I'm going to give it some example text of kind of what it's going to be like in the
game.
Let's say like a plus 11.
We're going to make it slightly different than what it is in the game.
Yeah, that's not bad, but let's make the background transparent.
Let's hit a weird label and then we'll go to background transparency.
Make that one.
Yeah, that's what I'm talking about.
Now, I could see that just appearing when I get the coin and then floating on up.